# encoding:utf-8
'''
@author : xaing
@time : 2019/4/3 15:37
@地址 : 广州
@作用 : 信号与槽
@结果 :
'''

import sys
from PyQt5.QtWidgets import QMainWindow, QApplication
from PyQt5 import QtCore, QtGui, QtWidgets

class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(759, 339)
        self.centralwidget = QtWidgets.QWidget(MainWindow)
        self.centralwidget.setObjectName("centralwidget")
        self.dial = QtWidgets.QDial(self.centralwidget)
        self.dial.setGeometry(QtCore.QRect(30, 60, 251, 231))
        self.dial.setObjectName("dial")
        self.horizontalSlider = QtWidgets.QSlider(self.centralwidget)
        self.horizontalSlider.setGeometry(QtCore.QRect(70, 20, 221, 31))
        self.horizontalSlider.setOrientation(QtCore.Qt.Horizontal)
        self.horizontalSlider.setObjectName("horizontalSlider")
        self.doubleSpinBox = QtWidgets.QDoubleSpinBox(self.centralwidget)
        self.doubleSpinBox.setGeometry(QtCore.QRect(460, 80, 191, 151))
        self.doubleSpinBox.setObjectName("doubleSpinBox")
        self.verticalSlider = QtWidgets.QSlider(self.centralwidget)
        self.verticalSlider.setGeometry(QtCore.QRect(330, 70, 22, 211))
        self.verticalSlider.setOrientation(QtCore.Qt.Vertical)
        self.verticalSlider.setObjectName("verticalSlider")
        MainWindow.setCentralWidget(self.centralwidget)

        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

    def retranslateUi(self, MainWindow):
        self.doubleSpinBox.valueChanged.connect(lambda:self.verticalSlider.setValue(self.doubleSpinBox.value()))
        self.verticalSlider.valueChanged.connect(lambda:self.horizontalSlider.setValue(self.verticalSlider.value()))
        self.horizontalSlider.valueChanged.connect(lambda: self.dial.setValue(self.horizontalSlider.value()))
        self.dial.valueChanged.connect(lambda : self.doubleSpinBox.setValue(self.dial.value()))


        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))


if __name__ == '__main__':
    app = QApplication(sys.argv)
    mainwindow = QMainWindow()
    uiWindows = Ui_MainWindow()
    uiWindows.setupUi(mainwindow)
    mainwindow.setWindowTitle("Changer")
    mainwindow.show()
    sys.exit(app.exec_())
    pass